package com.elasticjob.listener;

import com.dangdang.ddframe.job.executor.ShardingContexts;
import com.dangdang.ddframe.job.lite.api.listener.AbstractDistributeOnceElasticJobListener;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author: TongRui乀
 * @Date: 2019-12-12 10:30
 * @description：
 */
@Slf4j
public class MySimpleJobDistributeListener extends AbstractDistributeOnceElasticJobListener {

    public MySimpleJobDistributeListener(long startedTimeoutMilliseconds, long completedTimeoutMilliseconds) {
        super(startedTimeoutMilliseconds, completedTimeoutMilliseconds);
    }

    @Override
    public void doBeforeJobExecutedAtLastStarted(ShardingContexts shardingContexts) {
        log.info("分布式Job监听器 当前EventSimpleCount：{}, 监听到Job即将开始", shardingContexts.getCurrentJobEventSamplingCount());
    }

    @Override
    public void doAfterJobExecutedAtLastCompleted(ShardingContexts shardingContexts) {
        log.info("分布式Job监听器 当前任务执行完毕 --------------------------------->");
    }
}
